perm filename MAP.FAI[HAK,HPM] blob sn#062497 filedate 1975-05-20 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	title map program to do VDSMAP UUOs
C00003 00003	start:	outstr [asciz /Type line or ?	/]
C00010 00004	outoct:	idivi b,10
C00016 ENDMK
C⊗;
title map program to do VDSMAP UUOs

f←0			;flags
a←1			;char
b←2
c←3
d←4
e←5
x←6
l←10			;line number
ol←11			;old line
t←12			;saver
fn←13			;function code from user
uuo←14			;vdsmap ac
map←15			;map for vdsmap
omap←16			;map for typeout
p←17

;lh of f

.mast←←1		;master function
.list←←2		;all in sequence
.del←←4			;deleting in master mode
.nop←←10		;just listing

;rh of f

.linfo←←1		;user has seen line info
.oinfo←←2		;user has seen option info

;rh of e, in getmap

.num←←1			;number in progress
.temp←←2		;user typed T

lpdl←←20
start:	outstr [asciz /Type line or ?	/]
	movei a,reent
	movem a,jobren↑
	setzb f,ol
	tro f,.oinfo+.linfo
	jrst start2
start1:	outstr [asciz /Type * for all lines at once, <ALT> for all lines in
sequence, . for yourself, : to list all lines only, or a line number:	/]
	setzb f,ol
start2:	setzb fn,map
	move p,[iowd lpdl,pdl]
gline:	setz l,		;line ac
glp:	inchwl a
	cain a,"*"
	jrst master	;* means master function
	cain a,12
	jrst lf		;lf means next
	cain a,15
	jrst cr		;end of number
	cain a,175
	jrst list	;altmode to list them
	cain a,"."
	jrst dot
	cain a,":"
	jrst colon	;colon lists current status only
	cain a,"?"
	jrst help
	cail a,"0"
	caile a,"7"
	jrst lerr	;else better be oit
	lsh l,3
	addi l,-"0"(a)
	jrst glp

dot:	inchwl a
	caie a,15
	jrst lerr
	inchwl a
	caie a,12
	jrst lerr
	movni a,1
	getlin a
	movei l,(a)
	aoje a,lerr
	jrst cr1

help:	clrbfi
	jrst start1

master:	jumpn l,lerr
	inchwl a
	caie a,15
	jrst lerr
	inchwl a
	caie a,12
	jrst lerr
	tlo f,.mast
	pushj p,getmap		;what does he want?
	 exit			;he better want something
	ldb b,[point 3,fn,8+18]	;function code
	caie b,3		;is it delete?
	jrst mnodel		;no
	trnn map,7		;yes, is it DD chans only?
	tloa f,.del		;yes, set flag
mnodel:	tlz f,.del		;  to prevent nulling somebody
	movei l,26
	movei ol,26
mnext:	tlnn f,.del
	jrst mdoit
	movei b,(fn)		;check delete: get temp bit from fn
	trz b,377777
	addi b,(l)
	hrlzi uuo,(b)
	vdsmap uuo,		;get his map
	andcm uuo,map		;turn off our bits
	jumpe uuo,mdont		;don't do it if nothing left
mdoit:	pushj p,mapper
	 jrst mlose
mdont:	aos l,ol
	caie l,120
	jrst mnext
	jrst done

mlose:	outstr [asciz /VDSMAP FAILURE, ABORTING * MODE.
/]
	exit

colon:	inchwl a
	caie a,15
	jrst lerr
	inchwl a
	caie a,12
	jrst lerr
	tloa f,.nop
list:	outstr [asciz /
/]
	jumpn l,lerr
	tlo f,.list
	movei l,26
	movei ol,26
	jrst info

lf:	outchr [15]
	jumpn l,lerr
	aoja ol,cr2

next:	aos l,ol
	caie l,120
	jrst info
done:	setz ol,
	outstr [asciz /DONE.
/]
	hrrzs f
	setz ol,
	jrst restar

lerr:	outstr [asciz /
MAP WHAT?/]
	clrbfi
	exit

cr:	inchwl a
	caie a,12
	jrst lerr
	jumpe l,.+2
cr1:	movei ol,(l)
cr2:	movei l,(ol)
	cail l,400
	caile l,405
	jrst .+2
	jrst info
	cail l,26
	cail l,120
	jrst lerr
info:	outstr [asciz /LINE /]
	movei b,(l)
	pushj p,outoct
	outstr [asciz /:	/]
	hrlzi uuo,400000(l)
	vdsmap uuo,		;get permanent map
	trz uuo,1b32		;turn off async bit
	move t,uuo
	move omap,uuo
	pushj p,outmap
	hrlzi uuo,(l)
	vdsmap uuo,
	trz uuo,1b32
	move omap,uuo		;save temp map
	camn omap,t
	jrst notemp		;temp map same as perm
	outstr [asciz /(TEMP:)	/]
	pushj p,outmap		;else type it
notemp:	tlnn f,.nop
	pushj p,getmap		;ask user what to do
	 jrst nomap		;he said nothing
	pushj p,mapper
	outstr [asciz /FAILED!
/]
nomap:	tlne f,.list
	jrst next		;list mode, do next line
	tron f,.linfo
	outstr [asciz /<LF> now means the next line, <CR> the same line.
/]
restar:	outstr [asciz /LINE?	/]
	jrst gline

reent:	movni a,1
	setprv a,
	tlo a,4000		;upgprv
	setprv a,
	jrst restar

mapper:	movei b,(fn)
	addi b,(l)
	hrlzi uuo,(b)
	hrri uuo,map
	vdsmap uuo,		;do it
ifn 1,<	 popj p,
	jrst popj1>
ife 1,<	 jrst failed		;no, try ddchan diddle
	jrst popj1
failed:	andca uuo,map		;failed, try the ddchan technique
	move a,uuo
	trz a,17		;flush junk
	jumpe a,cpopj		;this shouldn't happen
rejffo:	jffo a,badchn		;got a channel number in b
	movei b,(fn)
	addi b,(l)
	hrlzi uuo,(b)
	hrri uuo,map
	vdsmap uuo,
	 popj p,		;failed for good
	jrst popj1		;aha, gotcha!
badchn:	movei c,200(b)		;"get status"
	ddchan c,		;this always wins
	tro c,300		;"set status"
	tlze c,400000		;privacy flag
	ddchan c,		;only do uuo if it was on before
	jfcl			;don't worry about failures
	hrlzi c,400000		;turn off the goddamn bit
	movns b			;like JFFO oughta!
	lsh c,(b)
	tdz a,c
	jrst rejffo
>;this should be put in if they let UPG do DDCHAN to somebody else
outoct:	idivi b,10
	jumpe b,outoc1
	hrlm c,(p)
	pushj p,outoct
	hlrz c,(p)
outoc1:	addi c,"0"
	outchr c
	popj p,

outmap:	hrlzi x,-40		;type out map from ac map
	move e,omap
outma1:	setz d,
	lshc d,1		;gobble bit
	jumpe d,outma2
	movei b,(x)
	pushj p,outoct		;output chan in map
	outchr [40]
outma2:	aobjn x,outma1		;loop on dd chans
	lsh e,1			;flush async bit
	setz d,
	lshc d,3		;gobble TV channel
	jumpe d,outma3
	movei b,40(d)
	pushj p,outoct
outma3:	outstr [asciz /
/]
	popj p,

getmap:	tron f,.oinfo
maphlp:	outstr [asciz /In specifying a map, you can type a list of channel numbers
separated by spaces and ending with <CR>.  You can also type:

<CR> alone	No change
+ <list>	Add to map
- <list>	Delete from map
R		Reset map
T<one of above>	Operate on temporary map
<ALT>		Same as last non-null operation used (invalid the first time!)

Thus you can alternate <CR> and <ALT> to perform a uniform operation on only
certain lines.
/]
	outstr [asciz /MAP?	/]
	setzb b,c		;b=number ac, c=map bits
	setzb d,e		;d=fn, e=flags
getlp:	inchwl a
	caie a,40
	cain a,11
	jrst endnum		;space or tab ends number
	cain a,175
	jrst altmod		;return old op
	cain a,"+"
	jrst plus		;add to map
	cain a,"-"
	jrst minus		;delete from map
	caie a,"R"
	cain a,"r"
	jrst mreset		;reset map
	caie a,"T"
	cain a,"t"
	jrst mtemp		;do it to temp map
	cain a,"?"
	jrst mq			;he wants help
	cain a,15
	jrst gotit		;he's done typing
	cail a,"0"
	caile a,"7"
	jrst lerr		;else gotta be oit
	tro e,.num
	lsh b,3
	addi b,-"0"(a)
	jrst getlp

mq:	clrbfi
	jrst maphlp

endnum:	trzn e,.num
	jrst getlp		;ignore space if no number
	pushj p,addmap		;add number in b to map in c
	setz b,
	cain d,(4B8)
	jrst lerr		;reset doesn't take numbers
	jumpn d,getlp
	movei d,(1B8)		;no + or -, set map
	jrst getlp

plus:	jumpn b,lerr		;no plus after number
	movei b,(2B8)
	jrst plus1

minus:	jumpn b,lerr
	movei b,(3B8)
plus1:	jumpn c,lerr
	jumpn d,lerr
	movei d,(b)		;set function to + or -
	setz b,
	jrst getlp

mreset:	jumpn b,lerr
	jumpn c,lerr
	jumpn d,lerr
	movei d,(4B8)
	jrst getlp

mtemp:	jumpn b,lerr
	jumpn c,lerr
	jumpn d,lerr
	tron e,.temp
	jrst getlp
	jrst lerr

gotit:	inchwl a
	trze e,.num
	pushj p,addmap		;gobble last chan
	jumpn c,nonull		;check for just RETURN
	jumpn d,nonull
	trze e,.temp
	jrst lerr		;T alone no good
	popj p,			;else just don't skip return

nonull:	caie d,(4B8)		;unless this is reset,
	jumpe c,lerr		;gotta have a channel
	jumpn d,.+2
	movei d,(1B8)		;no + or -, set map
	move map,c
	movei fn,(d)
	trzn e,.temp
	addi fn,400000
popj1:	aos (p)
cpopj:	popj p,

altmod:	outstr [asciz /
/]
	jumpe fn,lerr		;altmod no good w/o an old fn
	jrst popj1

addmap:	cail b,40		;add chan b to map c
	jrst tvchan		;above 40 are not dd
	movns b
	hrlzi x,400000
	lsh x,(b)		;make bit mask
	tdoe c,x		;set the bit
	jrst lerr		;already on
	popj p,

tvchan:	caie b,40		;can't select 40
	cail b,50		;or above 47
	jrst lerr
	trne c,7
	jrst lerr		;only one allowed
	trz b,40		;turn off 40 bit
	addi c,(b)
	popj p,

pdl:	block lpdl

	end start